use ggez::graphics::*;
use ggez::Context;
use ggez::GameResult;

use crate::logic;
use crate::view::TILE_SIZE;

impl logic::terrian::Terrain {
    pub fn as_drawable(&self, ctx: &mut Context) -> GameResult<Mesh> {
        match self {
            logic::terrian::Terrain::Blank => MeshBuilder::new()
                .rectangle(
                    DrawMode::Fill(FillOptions::DEFAULT),
                    Rect::new(0.0, 0.0, TILE_SIZE, TILE_SIZE),
                    Color::from_rgba(0, 0, 0, 0),
                )?
                .build(ctx),
            logic::terrian::Terrain::Wall => MeshBuilder::new()
                .rectangle(
                    DrawMode::Stroke(StrokeOptions::DEFAULT.with_line_width(4.0)),
                    Rect::new(20.0, 20.0, 60.0, 60.0),
                    Color::BLACK,
                )?
                .build(ctx),
        }
    }
}
